﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
namespace BallData
{
    public class LeagueItem
    {
        public String lId;
        public String cnName;
        public String trName;
        public String enName;
        public String color;
        public String defShow;
        public Int32 matchNum;
        public Int32 overNum;

        public LeagueItem(String infostr)
        {
            var infoArr = infostr.Split(OddsUntil.SplitColumn);

            this.lId = infoArr[0];
            this.cnName = infoArr[1];
            this.trName = infoArr[2];
            this.enName = infoArr[3];
            this.color = infoArr[4];
            this.defShow = infoArr[5];

            this.matchNum = 0;
            this.overNum = 0;
            
        }
        public static String toJson(LeagueItem odds)
        {
            string json = JsonConvert.SerializeObject(odds);

            return json;

        }
        public static LeagueItem fromJson(String jsondata)
        {
            LeagueItem league = JsonConvert.DeserializeObject<LeagueItem>(jsondata);

            return league;
        }
    }
}
